package com.fansaikj.crm.domain;

import xyz.erupt.annotation.*;
import xyz.erupt.annotation.sub_erupt.*;
import xyz.erupt.annotation.sub_field.*;
import xyz.erupt.annotation.sub_field.sub_edit.*;
import xyz.erupt.upms.model.base.HyperModel;
import xyz.erupt.jpa.model.BaseModel;
import java.util.*;
import java.util.Date;
import javax.persistence.*;
import org.hibernate.annotations.GenericGenerator;

@Erupt(
    name = "产品表",
    power = @Power(importable = true, export = true)
)
@Table(name = "crm_product")   //数据库表名
@Entity
public class CrmProduct{


    @Id
    @GeneratedValue(generator="generator")
    @GenericGenerator(name="generator", strategy="native")
    @Column(nullable = false)
    @EruptField()
    private Long id;
    
    @Column(length = 100, nullable = false)
    @EruptField(
        views = @View(
            title = "产品名称",
            width = "120"
        ),
        edit = @Edit(
            title = "产品名称",
            notNull = true,
            search = @Search
        )
    )
    private String productName;
    
    @Column(length = 50, nullable = false, unique = true)
    @EruptField(
        views = @View(
            title = "产品编码",
            width = "120"
        ),
        edit = @Edit(
            title = "产品编码",
            notNull = true,
            search = @Search
        )
    )
    private String productCode;
    
    @Column(length = 50)
    @EruptField(
        views = @View(
            title = "产品类型",
            width = "120"
        ),
        edit = @Edit(
            title = "产品类型",
            search = @Search
        )
    )
    private String productType;
    
    @Column(precision = 15, scale = 2, nullable = false)
    @EruptField(
        views = @View(
            title = "单价",
            width = "120"
        ),
        edit = @Edit(
            title = "单价",
            notNull = true,
            search = @Search
        )
    )
    private Float unitPrice;
    
    @Column(length = 20, nullable = false)
    @EruptField(
        views = @View(
            title = "产品状态",
            width = "120"
        ),
        edit = @Edit(
            title = "产品状态",
            notNull = true
        )
    )
    private String productStatus;
    
    @Lob
    @EruptField(
        views = @View(
            title = "产品描述",
            width = "120"
        ),
        edit = @Edit(
            title = "产品描述"
        )
    )
    private String description;
    
    @Column(length = 50, nullable = false)
    @EruptField(
        views = @View(
            title = "create_by",
            width = "120"
        ),
        edit = @Edit(
            title = "create_by",
            notNull = true
        )
    )
    private String createBy;
    
    @Column(nullable = false)
    @EruptField(
        views = @View(
            title = "create_time",
            width = "120"
        ),
        edit = @Edit(
            title = "create_time",
            notNull = true,
            type = EditType.DATE,
            dateType = @DateType(type = DateType.Type.DATE)
        )
    )
    private Date createTime;
    
    @Column(length = 50)
    @EruptField(
        views = @View(
            title = "update_by",
            width = "120"
        ),
        edit = @Edit(
            title = "update_by"
        )
    )
    private String updateBy;
    
    @EruptField(
        views = @View(
            title = "update_time",
            width = "120"
        ),
        edit = @Edit(
            title = "update_time",
            type = EditType.DATE,
            dateType = @DateType(type = DateType.Type.DATE)
        )
    )
    private Date updateTime;
    
    @Column(length = 255)
    @EruptField(
        views = @View(
            title = "remark",
            width = "120"
        ),
        edit = @Edit(
            title = "remark"
        )
    )
    private String remark;
    
    /*
    @OneToMany(cascade=CascadeType.ALL)
    @JoinColumn(name = "product_id")
    @EruptField(
        edit = @Edit(title = "产品报价表列表", type = EditType.TAB_TABLE_ADD)
    )
    private Set<CrmQuotation> crmQuotationList;
    */
    

}
